#include "StdAfx.h"
#include "xSDKCtrl.h"
#include "HubImage.h"

xSDKCtrl::xSDKCtrl(void)
{
}

xSDKCtrl::~xSDKCtrl(void)
{
}



void xSDKCtrl::InitWindowFinished()
{
	g_PLCCtrl.Initialize();
	g_RayCtrl.Initialize();
	g_HubCap.Initialize();
	g_HubImg.Initialize();

	m_pMainWd->InitWindowFinished();
	m_pSubWd->InitWindowFinished();

	SelectUsePlug();
}

void xSDKCtrl::InitDev()
{


}

void xSDKCtrl::SelectUsePlug()
{
	int nRet = DD_ERR_FAILURE;
	zkCapDevDesc xDesc;
	if( ReadCfgFile((void*)&xDesc,sizeof(zkCapDevDesc),"CapDevDesc"))
	{
		nRet = g_HubCap.SelectCapture(&xDesc);
	}
	if( DD_ERR_FAILURE == nRet )
	{
		g_HubCap.SearchCapture();
		zkCapDevDesc *pCapDevDesc;
		int nCount = 0 ;
		nRet = g_HubCap.GetCaptureList(&pCapDevDesc,nCount);
		if (nCount>0)
		{
			nRet = g_HubCap.SelectCapture(pCapDevDesc);
			if( DD_ERR_SUCCESS == nRet )
			{
				if(strlen(pCapDevDesc[0].cDevDllName)>0)
				{
					WriteCfgFile((void*)&pCapDevDesc[0],sizeof(zkCapDevDesc),"CapDevDesc");
				}
			}
		}
	}
}
